<!DOCTYPE html>
<html>

<head>
<title>号牌发货</title>
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">

<%include("/common/include.html"){}%>
<link rel="stylesheet" href="${cxt!}/sb/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
</head>

<body>
	<div class="easyui-panel" style="width: 100%; height:100%; padding: 30px 60px;">
		<form id="addRight" method="post" class="form">
		<div style="margin-bottom: 20px">
			<label class="label-top">所属模块:</label>
			<input id="marketManger" type="text" readonly style="width: 100%; height: 32.4px;" onclick="showMenu(); return false;" class="textbox" value="${right.parent.name! }"/>
			<input id="mangerids" type="hidden" name="right.parentids" value="${right.parentids! }">
		</div>
		<div style="margin-bottom: 20px">
			<label class="label-top">名称:</label>
			<input id="rName" class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="right.name" value="${right.name! }">
			<input type="hidden" name="right.ids" value="${ids }" />
		</div>
		<div style="margin-bottom: 20px">
			<label class="label-top" style="width: 100%; display: block;">URI:</label>
			<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="right.uri" value="${right.uri! }" >
		</div>
		<div style="margin-bottom: 20px">
			<label class="label-top">是否分页:</label>
			<select class="easyui-combobox theme-textbox-radius" name="right.splitpage" labelPosition="top" style="width:100%;">
				<option value="0" >否</option>
				<option value="1" >
				</option>
			</select>
		</div>
		<div style="margin-bottom: 20px">
			<label class="label-top">是否验证:</label>
			<select class="easyui-combobox theme-textbox-radius" name="right.privilegess" labelPosition="top" style="width:100%;">
				<option value="0">否</option>
				<option value="1" >
					</option>
			</select>
		</div>
		
		<div style="margin-bottom: 20px">
			<label class="label-top">是否禁用:</label>
			<select class="easyui-combobox theme-textbox-radius" name="right.status" labelPosition="top" style="width:100%;">
				<option value="0">是</option>
				<option value="1" >
					</option>
			</select>
		</div>
		
		<div style="margin-bottom: 20px">
			<label class="label-top">序号:</label>
			<input class="easyui-textbox theme-textbox-radius" style="width: 100%;" name="right.orderid" value="${right.orderid! }">
		</div>
		</form>

	</div>
	<div id="menuContent" class="menuContent" style="display: none; position: absolute;">
		<ul id="marketMangerTree" class="ztree" style="margin-top: 0;width:282px;"></ul>
	</div>

	<script type="text/javascript">
	//@ sourceURL=mmm.js
				var $form = $('#addRight');

				var submitNow = function($dialog, $grid, $tree, $pjq) {
					var url = "${cxt!}/right/updateRight";
					$.post(url, sy.serializeObject($form), function(result) {
						if (result.code == '200') {
							var curNode = $tree.getSelectedNodes()[0];
							curNode.name = $("#rName").val();
							$tree.updateNode(curNode);
							$grid.datagrid('reload');
// 							$pjq.messager.alert('提示', "更新成功", 'info');
							$.slideMsg("更新成功！", $pjq);
							$dialog.dialog('destroy');
						} else {
							$.alert($pjq, result.msg);
						}
					}, 'json');
				};
				var submitForm = function($dialog, $grid, $tree, $pjq) {
					submitNow($dialog, $grid, $tree, $pjq);
// 					$form.isValid(function(isValied){
// 						if(isValied){
// 							submitNow($dialog, $grid, $pjq);
// 						}
// 					});
				};

	</script>
	<script type="text/javascript">
	var setting = {
		async : {
			enable : true,
			url : '${cxt!}/right/treeData',
			autoParam : [ "id=ids" ],//, "name=n", "level=lv"
			type : "post"
		},
		view : {
			dblClickExpand : false
		},
		data : {
			simpleData : {
				enable : true
			}
		},
		callback : {
			onClick : onClick
		}
	};
	function onClick(e, treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("marketMangerTree");
		var name = "";
		var sNodes = zTree.getSelectedNodes();
		if (sNodes.length > 0) {
			name = sNodes[0].name;
		}
		var cityObj = $("#marketManger");
		cityObj.attr("value", name);
		$("#mangerids").attr("value", treeNode.id);
	}
	function showMenu() {
		var cityObj = $("#marketManger");
		var cityOffset = $("#marketManger").offset();
		$("#menuContent").css({
			left : cityOffset.left + "px",
			top : cityOffset.top + cityObj.outerHeight() + "px"
		}).slideDown("fast");

		$("body").bind("mousedown", onBodyDown);
	}
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn"
				|| event.target.id == "menuContent" || $(event.target)
				.parents("#menuContent").length > 0)) {
			hideMenu();
		}
	}
	$.fn.zTree.init($("#marketMangerTree"), setting);
	</script>
</body>
</html>